package com.codez.xml;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * java实体属性作为xml元素属性,需要的时候在测试
 * @author Admin
 *
 */

@XmlRootElement
//@XmlType(propOrder= {"id","name"})//顺序
@XmlAccessorType(XmlAccessType.FIELD)//以java属性为准
public class XmlDemo属性形式 {
	
	@XmlAttribute(required=false)
	private Integer idXX;
	@XmlAttribute
	private Integer id;
	@XmlAttribute
	private String name;
	@XmlElement(name="user")
	@XmlElementWrapper(name="users")
	private List<User> users;
	
	
	@XmlAccessorType(XmlAccessType.FIELD)
	public class User{
		@XmlAttribute
		private String name;
	}
}
